<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>登录</title>
  <script>
    let data = {
      username: 'admin1',
      password: '123321'
    }
    // 1.实例化xhr
    let xhr = new XMLHttpRequest();
    // 2.打开连接
    xhr.open('post', 'http://47.94.46.113:7788/user/login');
    // 2.1.配置请求头
    xhr.setRequestHeader('Content-Type', 'application/json');
    // 3.发送请求
    xhr.send(JSON.stringify(data))
    // 4.监听连接状态的改变
    xhr.onreadystatechange = function () {
      if (xhr.readyState === 4 && xhr.status === 200) {
        console.log(JSON.parse(xhr.response).data.token);
      }
    }
  </script>
</head>

<body>

</body>

</html>